package com.zhouxiaoge.transaction.registry.conf;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
@EnableWebSecurity
public class SecurityConf extends WebSecurityConfigurerAdapter {

    @Override
    public void configure(HttpSecurity httpSecurity) throws Exception {
        // 遵循默认配置开启Security验证,切关闭跨站请求，否则无法注册到Eureka
        httpSecurity.csrf().disable();
        super.configure(httpSecurity);
        // 重写配置，关闭Security验证
        //httpSecurity.authorizeRequests().anyRequest().permitAll().and().logout().permitAll();
    }
}
